<template>
  <div id="app">
    <router-view />
  </div>
</template>
<script>
import { mapActions } from "vuex";
export default {
  name: "App",
  created() {
    this.windowReSize();
    window.onresize = this.windowReSize;
  },
  methods: {
    ...mapActions(["setIsMobile"]),
    windowReSize() {
      let pageWidth = window.innerWidth;

      if (typeof pageWidth != "number") {
        //标准模式
        if (document.compatMode === "CSS1Compat") {
          pageWidth = document.documentElement.clientWidth;
          //怪异模式
        } else {
          pageWidth = document.body.clientWidth;
        }
      }
      this.setIsMobile(pageWidth <= 680);
    }
  }
};
</script>
